<template>
	<view class="category-container">
		<view class="category-list">
			<view class="category-item" v-for="(item, index) in categories" :key="index" @tap="selectCategory(item)">
				<image :src="item.icon" mode="aspectFit" class="category-icon"></image>
				<text class="category-name">{{item.name}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				categories: [
					{ name: '钻石', icon: '/static/category/diamond.png' },
					{ name: '黄金', icon: '/static/category/gold.png' },
					{ name: '铂金', icon: '/static/category/platinum.png' },
					{ name: '翡翠', icon: '/static/category/jade.png' },
					{ name: '珍珠', icon: '/static/category/pearl.png' },
					{ name: '彩宝', icon: '/static/category/colored.png' }
				]
			}
		},
		methods: {
			selectCategory(category) {
				uni.showToast({
					title: '选择了' + category.name,
					icon: 'none'
				})
			}
		}
	}
</script>

<style>
	.category-container {
		padding: 20rpx;
	}
	
	.category-list {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}
	
	.category-item {
		width: 33.33%;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 20rpx 0;
	}
	
	.category-icon {
		width: 100rpx;
		height: 100rpx;
		margin-bottom: 10rpx;
	}
	
	.category-name {
		font-size: 28rpx;
		color: #333;
	}
	
	.category-item:active {
		background-color: rgba(243, 178, 80, 0.1);
	}
</style> 